wayland: Fix some dnd corner case
authorMatthias Clasen <mclasen@redhat.com>
Sat, 19 Jun 2021 13:57:38 +0000 (06:57 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 19 Jun 2021 15:03:21 +0000 (08:03 -0700)
We must call gdk_drag_drop_done() when the drag ends,
successfully or not. Without this, we get an unwarranted
emission of ::cancel after a successful drop.

Since only the first call to gdk_drag_drop_done() is taking
effect, it is safe to call as a fallback, after emitting
::dnd-finished. If the application connects to that signal
and calls gdk_drag_drop_done() itself, its call will take
precedence.

This matches what the X11 implementation does.

gdk/wayland/gdkdrag-wayland.c

index de80afe020a31da5cd091dc34f4afe99eefbca48..8a8c4cc058f96218e67f8d9b5d270a889b7feeb3 100644 (file)
@@ -163,6 +163,7 @@ gdk_wayland_drag_cancel (GdkDrag             *drag,
                          GdkDragCancelReason  reason)
 {
   gdk_drag_set_cursor (drag, NULL);
+  gdk_drag_drop_done (drag, FALSE);
 }
 
 static void
@@ -290,6 +291,7 @@ data_source_dnd_finished (void                  *data,
   GdkDrag *drag = data;
 
   g_signal_emit_by_name (drag, "dnd-finished");
+  gdk_drag_drop_done (drag, TRUE);
 }
 
 static void